﻿using System;
using System.Web;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using KPIS.GERP.SERVICE.DAL;
using KPIS.GERP.SERVICE.BLL;
using KPIS.GERP.SERVICE.Model;

namespace KPIS.GERP.SERVICE.BLL
{
    public class BLLUser
    {
        DAL.User dalUser = new DAL.User();
        private BLLHrmPsEmployees bllHrmPsEmployees = new BLLHrmPsEmployees();

        public List<sys_sc_users> GetUser(string user_seq, string emp_seq, string user_code, string user_password, out string strError)
        {
            strError = string.Empty;
            List<sys_sc_users> userModel = dalUser.GetUser(user_seq, emp_seq, user_code, user_password, true);

            if (userModel.Count > 0 && userModel[0].hrm_ps_employees != null)
            {
                userModel[0].user_job_site_seq = userModel[0].hrm_ps_employees.working_job_site_seq;
                userModel[0].user_pos_seq = userModel[0].hrm_ps_employees.pos_seq;
            }
            else
            {
                strError = Common.ErrorNoUserData;
            }

            return userModel;
        }
    }
}
